package recurision;

import org.junit.Test;

import java.util.stream.Stream;

/**
 * =================================
 * <p>
 * Created by cjj on 18-10-13.
 * <p>
 * 描述: 斐波那契函数
 */

public class FibonacciSequence {

    @Test
    public void function() {
        //定义斐波那契函数输入值
        int n = 60;
        long result = fib(n);
        System.out.println(result);


    }

    public long fib(int n) {
        //这段代码 用于退出递归
        if (n <= 1) {
            return n;
        }
        return fib(n - 1) + fib(n - 2);
    }

    //函数式编程

}
